Skip to content

Remove brute-force workaround for DurableObject name lookup#257

Merged
lukevalenta merged 1 commit into
mainfrom
lvalenta/remove-do-name-workaround
Jul 16, 2026
Merged

Remove brute-force workaround for DurableObject name lookup#257
lukevalenta merged 1 commit into
mainfrom
lvalenta/remove-do-name-workaround

Conversation

@lukevalenta

Copy link
Copy Markdown
Contributor

The Durable Object runtime now passes through the name used with idFromName, so it is available inside the DO constructor via state.id().name() (cloudflare/workerd#2240).

Previously get_durable_object_name brute-forced the name by enumerating every configured log (and batcher shard) and comparing id_from_name results against the DO's id. Replace it with the runtime-provided name:

  • Sequencers and cleaners are unsharded, so their DO name is the base log name; they read state.id().name() directly.
  • Batchers are always addressed with a shard suffix ({name}_{shard_id:x}), so a new get_sharded_durable_object_base_name helper strips the trailing _{shard_id:x} component to recover the base log name.

Closes #201

The Durable Object runtime now passes through the name used with
`idFromName`, so it is available inside the DO constructor via
`state.id().name()` (cloudflare/workerd#2240).

Previously `get_durable_object_name` brute-forced the name by enumerating
every configured log (and batcher shard) and comparing `id_from_name`
results against the DO's id. Replace it with the runtime-provided name:

- Sequencers and cleaners are unsharded, so their DO name is the base log
  name; they read `state.id().name()` directly.
- Batchers are always addressed with a shard suffix (`{name}_{shard_id:x}`),
  so a new `get_sharded_durable_object_base_name` helper strips the trailing
  `_{shard_id:x}` component to recover the base log name.
@lukevalenta lukevalenta self-assigned this Jul 16, 2026
@lukevalenta lukevalenta merged commit 51e5245 into main Jul 16, 2026
8 checks passed
@lukevalenta lukevalenta deleted the lvalenta/remove-do-name-workaround branch July 16, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove workaround for DurableObject::name

2 participants